<?php
class SP_Common_Session
{
	protected static $sesion_var_name='_SP_SESSION_VARS_';
	
	public static function setSessionVarName($name)
	{
		self::$sesion_var_name=$name;
	}
	
	public static function set($name,$value)
	{
		$_SESSION[self::$sesion_var_name][$name]=$value;
	}
	
	public static function has($name)
	{
		return array_key_exists($name, $_SESSION[self::$sesion_var_name]);
	}
	
	public static function get($name,$value=null)
	{
		return self::has($name)? $_SESSION[self::$sesion_var_name][$name] : $value;
	}
	
	public static function del($name)
	{
		unset($_SESSION[self::$sesion_var_name][$name]);
	}
	
	public static function getOnce($name,$value=null)
	{
		$temp=self::get($name, $value);
		self::del($name);
		return $temp;
	}
	
	public static function getAll()
	{
		return $_SESSION[self::$sesion_var_name];
	}
	
}